package com.tich.ai.controller;

import com.tich.ai.config.WebClientConfig;
import com.tich.ai.domain.entity.ChatInfo;
import com.tich.ai.domain.entity.Message;
import com.tich.ai.service.AIService;
import com.tich.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/ai")
public class AIController {

    @Autowired
    private AIService aiService;

    /**
     * 调用大模型对话接口，流式输出
     * @param messages
     * @return
     * */
    @PostMapping("/chat")
    public Flux<String> chat(@RequestBody List<Message> messages){
        log.info("调用大模型对话接口，流式输出");
        return aiService.chat(messages);
    }

}
